<div class="layout_content" style="color: #404040;">
    <header class="demo-header" style="padding-top: 10px;">
        <div class="titleLeft flt">
            <a href="/ucenter/welcome/index.html">
                <img src="../public/img/back.png" width="35px" height="33px">
            </a>
        </div>
        <div class="titleRight flt text-center">更改密码</div>
    </header>
    <div class="updatepss-div margin-adjust">新密码 | <input type="text" placeholder="请输入新密码" id="newpass"/></div>
    <div class="updatepss-div">确&nbsp;认 | <input type="text" placeholder="请再输一次" id="confirm-newpass"/></div>
    <div style="text-align:center;" class="padding-top2">
        <input class="loginBtn" type="button" value="保存" onclick="updateSubmit()" style="width: 93%;padding: 12px 0;">
    </div>
    <div id="tip" class="tip" style="left: 25%">修改失败确认密码不能为空</div>
</div>

<script type="text/javascript" src="../public/js/jquery.js" ></script>
<script type="text/javascript" src="../public/js/product.js" ></script>
<script type="text/javascript">
    function updateSubmit(){
        var newpass = $('#newpass').val();
        var confirmpass = $('#confirm-newpass').val();
        if(newpass==""){
            $('#tip').html('修改失败新密码不能为空');
            Tip();
            return false;
        }else if(confirmpass==""){
            $('#tip').html('修改失败确认密码不能为空');
            Tip();
            return false;
        }else if(newpass!==confirmpass){
            $('#tip').html('修改失败两次输入不一致，请重新输入！');
            Tip();
            $('#newpass').val('');
            $('#confirm-newpass').val('');
            return false;
        }
        $.ajax({
            url: '/ajax/userpassward/',
            type: 'post',
            dataType: 'json',
            data: {
                'newpass': newpass,
                'ajaxdata':'pwd'
            },
            success: function (response) {
                layer.msg(response.msg);
                window.location.href ='<?php echo WEBROOT . '/welcome/logOut/'?>';
            },
            beforeSend: function () {
            }
        });
    }
</script>